The present invention relates to a data processing unit with hardware assisted context switching capabilities. Most embedded and real time control systems are designed according to a model in which interrupt handlers and software managed tasks are each considered to be executing on their own virtual microcontroller. That model is generally supported by the services of a real time executive or operating system, layered on top of the features and capabilities of the underlying machine architecture. A virtual microcontroller can be seen as a task having its own general purpose registers and associated special function registers like program counter, program status word, etc., which represent the task's context. Handling of these virtual microcontrollers in most of the known systems is done by means of software which saves and restores the respective context. Therefore, software for such a data processing unit needs an increased amount of memory and execution overhead for the context switching operation reduces the processing bandwidth available to application tasks.